package com.ddm.controller.wxadmin;


import com.ddm.constant.MessageConstant;
import com.ddm.dto.vxDTO.TestDTO;
import com.ddm.exception.DataErrorException;
import com.ddm.result.Result;
import com.ddm.service.vxService.TestService;
import com.ddm.vo.vxVo.TestVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author horizon
 * @since 2025-01-17
 */
@RestController
@RequestMapping("/admin/test")
@Slf4j
@Api("用户考试情况接口")
public class TestController {

    @Autowired
    TestService testService;

    @GetMapping
    @ApiOperation("根据用户id与考试名称查询考试详细得分")
    public Result<List<TestVO>> getTestById(@RequestBody TestDTO testDTO) {
        log.info("获取用户考试详细得分情况");
        if (testDTO.getExamName() == null || testDTO.getUserId() == null) {
            throw new DataErrorException(MessageConstant.NULL_DATA);
        }
        List<TestVO> list = testService.getTestById(testDTO);
        return Result.success(list);
    }
}
